package com.kma.summer2012.model;
// Generated Dec 6, 2012 12:14:41 AM by Hibernate Tools 3.2.1.GA


import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * CrumbsUser generated by hbm2java
 */
@Entity
@Table(name = "CRUMBS_USER"
        , schema = "KMA1"
)
public class CrumbsUser implements java.io.Serializable {


    private int userId;
    private CrumbsPosition crumbsPosition;
    private String login;
    private String password;
    private String phone;
    private String additionalInfo;
    private String surnmNmSecondnm;
    private Set<CrumbsProcessHistory> crumbsProcessHistoriesForSenderId = new HashSet<CrumbsProcessHistory>(0);
    private Set<CrumbsProcessHistory> crumbsProcessHistoriesForRecieverId = new HashSet<CrumbsProcessHistory>(0);
    private Set<CrumbsRequest> crumbsRequests = new HashSet<CrumbsRequest>(0);

    public CrumbsUser() {
    }


    public CrumbsUser(int userId, CrumbsPosition crumbsPosition, String login, String password, String phone, String surnmNmSecondnm) {
        this.userId = userId;
        this.crumbsPosition = crumbsPosition;
        this.login = login;
        this.password = password;
        this.phone = phone;
        this.surnmNmSecondnm = surnmNmSecondnm;
    }

    public CrumbsUser(int userId, CrumbsPosition crumbsPosition, String login, String password, String phone, String additionalInfo, String surnmNmSecondnm, Set<CrumbsProcessHistory> crumbsProcessHistoriesForSenderId, Set<CrumbsProcessHistory> crumbsProcessHistoriesForRecieverId, Set<CrumbsRequest> crumbsRequests) {
        this.userId = userId;
        this.crumbsPosition = crumbsPosition;
        this.login = login;
        this.password = password;
        this.phone = phone;
        this.additionalInfo = additionalInfo;
        this.surnmNmSecondnm = surnmNmSecondnm;
        this.crumbsProcessHistoriesForSenderId = crumbsProcessHistoriesForSenderId;
        this.crumbsProcessHistoriesForRecieverId = crumbsProcessHistoriesForRecieverId;
        this.crumbsRequests = crumbsRequests;
    }

    @Id
    @Column(name = "USER_ID", unique = true, nullable = false, precision = 9, scale = 0)
    public int getUserId() {
        return this.userId;
    }

    public void setUserId(int userId) {
        this.userId = userId;
    }

    @ManyToOne(fetch = FetchType.EAGER)
    @JoinColumn(name = "POSITION_ID", nullable = false)
    public CrumbsPosition getCrumbsPosition() {
        return this.crumbsPosition;
    }

    public void setCrumbsPosition(CrumbsPosition crumbsPosition) {
        this.crumbsPosition = crumbsPosition;
    }

    @Column(name = "LOGIN", nullable = false, length = 60)
    public String getLogin() {
        return this.login;
    }

    public void setLogin(String login) {
        this.login = login;
    }

    @Column(name = "PASSWORD", nullable = false, length = 60)
    public String getPassword() {
        return this.password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    @Column(name = "PHONE", nullable = false, length = 20)
    public String getPhone() {
        return this.phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    @Column(name = "ADDITIONAL_INFO", length = 1000)
    public String getAdditionalInfo() {
        return this.additionalInfo;
    }

    public void setAdditionalInfo(String additionalInfo) {
        this.additionalInfo = additionalInfo;
    }

    @Column(name = "SURNM_NM_SECONDNM", nullable = false, length = 60)
    public String getSurnmNmSecondnm() {
        return this.surnmNmSecondnm;
    }

    public void setSurnmNmSecondnm(String surnmNmSecondnm) {
        this.surnmNmSecondnm = surnmNmSecondnm;
    }

    @OneToMany(cascade = {CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH}, fetch = FetchType.LAZY, mappedBy = "crumbsUserBySenderId")
    public Set<CrumbsProcessHistory> getCrumbsProcessHistoriesForSenderId() {
        return this.crumbsProcessHistoriesForSenderId;
    }

    public void setCrumbsProcessHistoriesForSenderId(Set<CrumbsProcessHistory> crumbsProcessHistoriesForSenderId) {
        this.crumbsProcessHistoriesForSenderId = crumbsProcessHistoriesForSenderId;
    }

    @OneToMany(cascade = {CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH}, fetch = FetchType.LAZY, mappedBy = "crumbsUserByRecieverId")
    public Set<CrumbsProcessHistory> getCrumbsProcessHistoriesForRecieverId() {
        return this.crumbsProcessHistoriesForRecieverId;
    }

    public void setCrumbsProcessHistoriesForRecieverId(Set<CrumbsProcessHistory> crumbsProcessHistoriesForRecieverId) {
        this.crumbsProcessHistoriesForRecieverId = crumbsProcessHistoriesForRecieverId;
    }

    @ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
    @JoinTable(name = "CRUMBS_REQUEST_ASSIGN", schema = "KMA1", joinColumns = {
            @JoinColumn(name = "USER_ID", nullable = false, updatable = false)}, inverseJoinColumns = {
            @JoinColumn(name = "REQUEST_ID", nullable = false, updatable = false)})
    public Set<CrumbsRequest> getCrumbsRequests() {
        return this.crumbsRequests;
    }

    public void setCrumbsRequests(Set<CrumbsRequest> crumbsRequests) {
        this.crumbsRequests = crumbsRequests;
    }


}


